export default class GoodDetailQueryDTO {
  static instance () {
    return new GoodDetailQueryDTO()
  }

  getSearchType () {
    return this.searchType
  }

  /**
   * 设置搜索模式
   * @param {String} searchType
   */
  setSearchType (searchType) {
    this.searchType = searchType
  }

  getSearch () {
    return this.search
  }

  /**
   * 设置search
   * @param {Array<String>} search
   */
  setSearch (search) {
    if (search) {
      this.search = search
    }
  }

  /**
   * 添加search
   * @param {String} search
   */
  addSearch (search) {
    if (search) {
      if (this.search) {
        this.search.push(search)
      } else {
        this.search = [search]
      }
    }
  }
}

export const SearchTypeConstants = {
  SEARCH_TYPE_GOODS_NAME: 'name',
  SEARCH_TYPE_TYPE: 'type',
  SEARCH_TYPE_DEFAULT: 'default'
}
